<template>
    <div class="comment_boards-detail" v-loading="loading">
        <div>
            <e-container>
                <div  style="margin:10px 0 0 0">
                    <e-module-model-box title="所有留言显示">


                        <el-table border :data="list" style="width: 100%" highlight-current-row>

                            <el-table-column type="index" label="#"></el-table-column> <!-- 序号 -->

                            <el-table-column label="姓名">
                                <template slot-scope="{map}">
                                    {{  map.xingming  }}
                                </template>
                            </el-table-column>
                            <el-table-column label="留言内容">
                                <template slot-scope="{map}">
                                    {{  map.liuyanneirong  }}
                                </template>
                            </el-table-column>
                            <el-table-column label="留言人">
                                <template slot-scope="{map}">
                                    {{  map.liuyanren  }}
                                </template>
                            </el-table-column>
                            <el-table-column label="添加时间">
                                <template slot-scope="{map}">
                                    {{  map.addtime  }}
                                </template>
                            </el-table-column>

                            <el-table-column label="点赞" width="80">
                                <template v-slot="{ row }">
                                    <el-button type="success" @click="handleLike(row)">点赞</el-button>
                                </template>
                            </el-table-column>


                        </el-table>


                    </e-module-model-box>

                </div>

            </e-container>
        </div>    </div>
</template>
<style type="text/scss" scoped lang="scss">
</style>
<script>
    import api from '@/api';

    import { extend } from '@/utils/extend';

    export default {
        data() {
            return {
                loading:false,   // 加载
                isCollect:false, // 是否已经收藏
                map:{
                    xingming:'',
                    lianxidianhua:'',
                    liuyanneirong:'',
                    liuyanren:'',
                    huifuneirong:'',
                    addtime:'',
                },
            }
        },
        props:{
            id:{
                type:[String,Number],
                required:true
            }
        },
        watch: {
            id:{
                handler(){
                    this.loadDetail();
                },
                immediate:true
            },
        },
        computed: {
        },
        methods: {
            //后台获取信息
            loadDetail(){
                if(this.loading) return;
                this.loading = true;
                this.$get(api.comment_boards.webdetail , {//get请求获取信息
                    id:this.id//传送数据id
                }).then(res=>{//成功
                    this.loading = false;
                    if(res.code == api.code.OK){
                        extend(this,res.data);
                    }else{//数据不匹配
                        this.$message.error(res.msg);
                    }
                }).catch(err=>{//失败
                    this.loading = false;
                    this.$message.error(err.message);
                });
            },

        },
        created() {
        },
        mounted() {
        },
        destroyed() {
        }
    }
</script>
